package com.vicki.music;

import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class MediaUpdateReceiver extends BroadcastReceiver{

	 private AlertDialog.Builder  builder = null;  
	    private AlertDialog ad = null;  
	    @Override  
	    public void onReceive(Context context, Intent intent) {  
	        String action = intent.getAction();  
	        if (Intent.ACTION_MEDIA_SCANNER_STARTED.equals(action)){  

	        	builder = new AlertDialog.Builder(context);  
	            builder.setMessage(R.string.scanning);  
	            ad = builder.create();  
	            ad.show();  
	        }else if(Intent.ACTION_MEDIA_SCANNER_FINISHED.equals(action)){  
	        	MediaUtils utils = MediaUtils.getInstense();
	        	utils.bind_data_adapter(context, MediaUtils.Data_Songs);
	           if(ad!=null&&ad.isShowing()){
	        	   ad.dismiss();
	           } 
	        }     
	    }  
}
